@extends('admin.layout.layout', ['row' => @$page])

@section('contain')

    <div class="portlet">
        <div class="portlet-title">
            <div class="caption">
                <x-portlet-breadcrumb :page="$page"></x-portlet-breadcrumb>
            </div>
            <div class="actions"></div>
        </div>

        <div class="filter-wrapper">
            <form action="/{{ request()->path() }}/" class="form-inline filter-form">

                <div class=" input-group mb-3 custom-control-inline">
                    <input type="text" class="form-control s-input" name="value" value="{{ request()->input('value') }}" placeholder="{{ ts('JXSTBST1') }}">
                </div>

                <x-flatpickr-date-range></x-flatpickr-date-range>

                <div class="mb-3">
                    <button class="btn btn-primary">{{ ts('SEARCH') }}</button>
                    <a href="/{{ request()->path() }}/" class="btn btn-warning">{{ ts('RESET') }}</a>
                </div>

            </form>
        </div>
        {{--<div class="container-fluid my-3">
            <div class="row">
                <div class="col"></div>
                <div class="col-auto">
                    <button class="btn btn-info" onclick="tbU()">{{ ts('TONGBU') }}</button>
                </div>
            </div>
        </div>--}}
        <div>
            <div class="text-nowrap">
                <table class="table bt-table d-none text-center">
                    <thead>
                    <tr class="order_column text-center">
                        <th>{{ ts('sequence') }}</th>
                        {{--<th>{{ ts('bjxtid') }}</th>--}}
                        <th>{{ ts('ZH') }}</th>
                        {{--<th>{{ ts('userid') }}</th>--}}
                        <th>{{ ts('jc') }}</th>
                        {{--<th>{{ ts('COMPANYNAME') }}</th>--}}
                        <th>{{ ts('STATUS') }}</th>
                        <th>{{ ts('CONTACTPERSON') }}</th>
                        <th>{{ ts('CONTACTINFORMATION') }}</th>
                        <th>{{ ts('TBSJ') }}</th>
                        <th class="fixed-td" style="width:270px">
                            {{ ts('OPERATIONS') }}
                        </th>
                    </tr>
                    </thead>
                    <tbody>
                    @foreach($data as $k => $v)
                        <tr class="item-list">
                            <td>{{ @$data->firstItem()+$k }}</td>
                            <td>
                                {{-- @$v->union_id --}}
                                {{ @$v->unique_id }}
                            </td>
                            {{--<td>
                                {{ @$v->ubid }}
                                --}}{{--{{ @$v->user_id }}--}}{{--
                            </td>--}}
                            <td>
                                @empty(json_decode(@$v->datas))
                                @else
                                    {{ @json_decode($v->datas)->abbr }}
                                @endif
                            </td>
                            {{--<td>{{ @json_decode($v->datas)->company_name }}</td>--}}
                            <td>{{ ts('tbs'.(@$v->status ?: 0)) }}</td>
                            <td>{{ @json_decode($v->datas)->first_name }}</td>
                            <td>{{ rsPN(@json_decode($v->datas)->phone_number) }}</td>
                            <td>
                                {{ fdate2(@$v->created_at) }}
                            </td>
                            <td  class="fixed-td text-center" style="width:270px">
                                <a class="btn btn-success btn-sm" href='/{{ request()->path() }}/{{ $v->id }}'>{{ ts('VIEW') }}</a>
                            </td>
                        </tr>
                    @endforeach
                    </tbody>
                </table>
            </div>
            <div class="row my-3">
                <div class="col">
                    {{ $data->appends(request()->input())->links() }}
                </div>
            </div>
        </div>

    </div>


@endsection

@section('script')
    <script>

        $('.table.bt-table').bootstrapTable({
            fixedColumns: true,
            fixedNumber: 1,
            fixedRightNumber: 1,
        }).removeClass('d-none')

        function tbU() {
            return false;
            /*request.get('/admin/ajax/user_sync_test')
                .then(function (d) {
                    request.post('/admin/ajax/user_sync_h', {
                        data: d.data
                    })
                        .then(function (d) {
                            console.log(d)
                            sweetAlert('', d.msg || 'SUCCESS', 'success').then(function (d) {
                                window.location.reload();
                            })

                        })
                        .catch(function (d) {
                            console.log('error', d)
                            sweetAlert('', d.msg || 'error', 'error')
                        })
                })
                .catch(function (d) {
                    console.log('error2', d)
                    sweetAlert('', d.msg || 'error', 'error')
                })*/
        }
    </script>
@endsection